var _Step = require('scenes/game/toturial/step.js');
var _inherit = require('core/inherit.js');
var _global = require('global/global.js');

function Step() {
    _Step.call(this);
}
_inherit(Step, _Step);
Step.prototype.onSwip = function () {
    this.mLocal.find('gamearea').resetTouch();
    this.mToturial.hideFooter();
    _global.scheduleTask(this.finishStep, this);
};
Step.prototype.onMergeFinish = function () {
    if (this.hasSlot(6)) {
        this.mToturial.nextStep();

        this.mLocal = null;
        this.mToturial = null;
    }
};
Step.prototype.finishStep = function () {
    this.mLocal.find('ui.scene').cancelTouchDelegate();
    this.mToturial.nextStep();

    this.mLocal = null;
    this.mToturial = null;
};
Step.prototype.onStart = function (toturial, local) {
    this.mToturial = toturial;
    this.mLocal = local;

    var rtf = this.equationHeader().textBuilder()
        .addText('3', 'black')
        .addText(' + ', 'gray')
        .addText('3', 'black')
        .addText(' = ', 'gray')
        .addText('6', 'red')
        .create();
    toturial.showHeaderTip(rtf);
};

module.exports = Step;